<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery/jquery-3.2.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#file_upload').bind("change", function () {
                //var fileName = $('#file_upload').val();　　　　　　　　　　　　　　　　　　//获得文件名称
                //var fileType = fileName.substr(fileName.length-4,fileName.length);　　//截取文件类型,如(.xls)
                $.ajax({
                    url: '/file/upload',
                    type: 'POST',
                    cache: false,
                    data: new FormData($('#uploadForm')[0]),//表单数据
                    processData: false,
                    contentType: false,
                    success:function(data){
                        console.log(data);
                        $("#result").html(JSON.stringify(data));
                    }
                });
            });
        });
    </script>
</head>
<body>
<form id="uploadForm" enctype="multipart/form-data">
    <input id="file_upload" name="file" type="file"/>
</form>
<div id="result"></div>
</body>
</html>